/*
 * 模拟服务器数据
 * 在后台服务没有好的时候调用
 * dva会自动使用
 */

const random_jokes = [
    {
        setup: 'What is the object oriented way to get wealthy ?',
        punchline: 'Inheritance',
    },
    {
        setup: 'To understand what recursion is...',
        punchline: "You must first understand what recursion is",
    },
    {
        setup: 'What do you call a factory that sells passable products?',
        punchline: 'A satisfactory',
    },
];
let random_joke_call_count = 0;
export default {
    'get /mock/dev/random_joke': function (req, res) {
        const responseObj = random_jokes[random_joke_call_count % random_jokes.length]
        random_joke_call_count++;
        setTimeout(()=>{
            res.json(responseObj)
        },300)
    }
}